{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "06f2e717",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>是否必选</th>\n",
       "      <th>参数名</th>\n",
       "      <th>类型</th>\n",
       "      <th>参数说明</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>必选</td>\n",
       "      <td>api_key</td>\n",
       "      <td>String</td>\n",
       "      <td>调用此 API 的 API Key</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>必选</td>\n",
       "      <td>api_secret</td>\n",
       "      <td>String</td>\n",
       "      <td>调用此 API 的 API Secret</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>可选</td>\n",
       "      <td>display_name</td>\n",
       "      <td>String</td>\n",
       "      <td>人脸集合的名字，最长256个字符，不能包括字符^@,&amp;=*'\"</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>可选</td>\n",
       "      <td>outer_id</td>\n",
       "      <td>String</td>\n",
       "      <td>账号下全局唯一的 FaceSet 自定义标识，可以用来管理 FaceSet 对象。最长255...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>可选</td>\n",
       "      <td>tags</td>\n",
       "      <td>String</td>\n",
       "      <td>FaceSet 自定义标签组成的字符串，用来对 FaceSet 分组。最长255个字符，多个...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>可选</td>\n",
       "      <td>face_tokens</td>\n",
       "      <td>String</td>\n",
       "      <td>人脸标识 face_token，可以是一个或者多个，用逗号分隔。最多不超过5个 face_t...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>可选</td>\n",
       "      <td>user_data</td>\n",
       "      <td>String</td>\n",
       "      <td>自定义用户信息，不大于16 KB，不能包括字符^@,&amp;=*'\"</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>可选</td>\n",
       "      <td>force_merge</td>\n",
       "      <td>Int</td>\n",
       "      <td>在传入 outer_id 的情况下，如果 outer_id 已经存在，是否将 face_to...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  是否必选           参数名      类型  \\\n",
       "0   必选       api_key  String   \n",
       "1   必选    api_secret  String   \n",
       "2   可选  display_name  String   \n",
       "3   可选      outer_id  String   \n",
       "4   可选          tags  String   \n",
       "5   可选   face_tokens  String   \n",
       "6   可选     user_data  String   \n",
       "7   可选   force_merge     Int   \n",
       "\n",
       "                                                参数说明  \n",
       "0                                  调用此 API 的 API Key  \n",
       "1                               调用此 API 的 API Secret  \n",
       "2                    人脸集合的名字，最长256个字符，不能包括字符^@,&=*'\"  \n",
       "3  账号下全局唯一的 FaceSet 自定义标识，可以用来管理 FaceSet 对象。最长255...  \n",
       "4  FaceSet 自定义标签组成的字符串，用来对 FaceSet 分组。最长255个字符，多个...  \n",
       "5  人脸标识 face_token，可以是一个或者多个，用逗号分隔。最多不超过5个 face_t...  \n",
       "6                    自定义用户信息，不大于16 KB，不能包括字符^@,&=*'\"  \n",
       "7  在传入 outer_id 的情况下，如果 outer_id 已经存在，是否将 face_to...  "
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "\n",
    "pd.read_html(\"\"\"<div class=\"table-wrap\"><table class=\"wrapped confluenceTable\"><colgroup><col><col><col><col></colgroup><tbody><tr><th class=\"confluenceTh\"><p><span style=\"color: rgb(0,0,0);\">是否必选</span></p></th><th class=\"confluenceTh\"><p><span style=\"color: rgb(0,0,0);\">参数名</span></p></th><th class=\"confluenceTh\"><p><span style=\"color: rgb(0,0,0);\">类型</span></p></th><th class=\"confluenceTh\"><p><span style=\"color: rgb(0,0,0);\">参数说明</span></p></th></tr><tr><td class=\"confluenceTd\"><p><span style=\"color: rgb(0,0,0);\">必选</span></p></td><td class=\"confluenceTd\"><p><span style=\"color: rgb(0,0,0);\">api_key</span></p></td><td class=\"confluenceTd\"><p><span style=\"color: rgb(0,0,0);\">String</span></p></td><td class=\"confluenceTd\"><p><span style=\"color: rgb(0,0,0);\">调用此 API 的 API Key</span></p></td></tr><tr><td class=\"confluenceTd\"><p><span style=\"color: rgb(0,0,0);\">必选</span></p></td><td class=\"confluenceTd\"><p><span style=\"color: rgb(0,0,0);\">api_secret</span></p></td><td class=\"confluenceTd\"><p><span style=\"color: rgb(0,0,0);\">String</span></p></td><td class=\"confluenceTd\"><p><span style=\"color: rgb(0,0,0);\">调用此 API 的 API Secret</span></p></td></tr><tr><td class=\"confluenceTd\"><span style=\"color: rgb(0,0,0);\">可选</span></td><td class=\"confluenceTd\"><span style=\"color: rgb(0,0,0);\">display_name</span></td><td class=\"confluenceTd\"><span style=\"color: rgb(0,0,0);\">String</span></td><td class=\"confluenceTd\"><span style=\"color: rgb(0,0,0);\">人脸集合的名字，最长<span class=\"inline-comment-marker\" data-ref=\"9f098728-ac30-41a2-aab6-05b79f8a7d2e\">256</span>个字符，不能包括字符^@,&=*'\"</span></td></tr><tr><td colspan=\"1\" class=\"confluenceTd\"><span style=\"color: rgb(0,0,0);\">可选</span></td><td colspan=\"1\" class=\"confluenceTd\"><span style=\"color: rgb(0,0,0);\">outer_id</span></td><td colspan=\"1\" class=\"confluenceTd\"><span style=\"color: rgb(0,0,0);\">String</span></td><td colspan=\"1\" class=\"confluenceTd\"><span style=\"color: rgb(0,0,0);\">账号下全局唯一的 FaceSet 自定义标识，可以用来管理 FaceSet 对象。最长255个字符，<span class=\"inline-comment-marker\" data-ref=\"63fc0fd1-cd44-4256-bab5-971a939d66e2\"><span class=\"inline-comment-marker\" data-ref=\"183dcb11-c22c-47f4-aa9c-2ba6f3c8210c\">不能包括字符^@,&=*'\"</span></span></span></td></tr><tr><td colspan=\"1\" class=\"confluenceTd\"><span style=\"color: rgb(0,0,0);\">可选</span></td><td colspan=\"1\" class=\"confluenceTd\"><span style=\"color: rgb(0,0,0);\">tags</span></td><td colspan=\"1\" class=\"confluenceTd\"><span style=\"color: rgb(0,0,0);\">String</span></td><td colspan=\"1\" class=\"confluenceTd\"><span style=\"color: rgb(0,0,0);\">FaceSet 自定义标签组成的字符串，用来对 FaceSet 分组。最长<span class=\"inline-comment-marker\" data-ref=\"1be760b6-f20d-4ff3-a086-b7f763abd84d\">255</span>个字符，多个 tag 用逗号分隔，每个 tag 不能包括字符^@,&=*'\"</span></td></tr><tr><td class=\"confluenceTd\"><p><span style=\"color: rgb(0,0,0);\">可选</span></p></td><td class=\"confluenceTd\"><p><span style=\"color: rgb(0,0,0);\">face_tokens</span></p></td><td class=\"confluenceTd\"><p><span style=\"color: rgb(0,0,0);\">String</span></p></td><td class=\"confluenceTd\"><p><span style=\"color: rgb(0,0,0);\">人脸标识 face_token，可以是一个或者多个，用逗号分隔。最多不超过5个 face_token</span></p></td></tr><tr><td colspan=\"1\" class=\"confluenceTd\"><span style=\"color: rgb(0,0,0);\">可选</span></td><td colspan=\"1\" class=\"confluenceTd\"><span style=\"color: rgb(0,0,0);\">user_data</span></td><td colspan=\"1\" class=\"confluenceTd\"><span style=\"color: rgb(0,0,0);\">String</span></td><td colspan=\"1\" class=\"confluenceTd\"><span style=\"color: rgb(0,0,0);\">自定义用户信息，不大于<span class=\"inline-comment-marker\" data-ref=\"f9edadb1-691d-4d80-933e-909096780f61\">16 KB，不能包括字符^@,&=*'\"</span></span></td></tr><tr><td colspan=\"1\" class=\"confluenceTd\"><span style=\"color: rgb(0,0,0);\">可选</span></td><td colspan=\"1\" class=\"confluenceTd\"><span style=\"color: rgb(0,0,0);\">force_merge</span></td><td colspan=\"1\" class=\"confluenceTd\"><span style=\"color: rgb(0,0,0);\">Int</span></td><td colspan=\"1\" class=\"confluenceTd\"><p><span style=\"color: rgb(0,0,0);\">在传入 outer_id 的情况下，如果 outer_id 已经存在，是否将 face_token 加入已经存在的 FaceSet 中</span></p><p><span style=\"color: rgb(0,0,0);\">0：不将 face_tokens 加入已存在的 FaceSet 中，直接返回 FACESET_EXIST 错误</span></p><p><span style=\"color: rgb(0,0,0);\">1：将 face_tokens 加入已存在的 FaceSet 中</span></p><p><span style=\"color: rgb(0,0,0);\">默认值为0</span></p></td></tr></tbody></table></div>\"\"\")[0]\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "c8c95c5a",
   "metadata": {},
   "outputs": [],
   "source": [
    "#1. 创建FaceSet\n",
    "import requests\n",
    "API_KEY = 'jRpCaZ34kqNYJ8Zppdc-yGGum_YkETov'\n",
    "API_S = 'Vr0PtRCw-ZFwYXTKVfi6aDNaSqlfunK3'\n",
    "# A-1 创建人脸数据集合\n",
    "FaceSet_url = \"https://api-cn.faceplusplus.com/facepp/v3/faceset/create\"\n",
    "payload = {\n",
    "    \"api_key\":API_KEY,\n",
    "    \"api_secret\":API_S\n",
    "}\n",
    "r = requests.post(url = FaceSet_url, params = payload)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "3a2599d5",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Response [200]>"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "e3aafd57",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'faceset_token': 'aa730386c1e33d7c129e0e8a01bf22b4',\n",
       " 'time_used': 171,\n",
       " 'face_count': 0,\n",
       " 'face_added': 0,\n",
       " 'request_id': '1647946992,6c78dfeb-5d2c-4003-9c22-7a7c1051ecb5',\n",
       " 'outer_id': '',\n",
       " 'failure_detail': []}"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r.json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "925224a7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'aa730386c1e33d7c129e0e8a01bf22b4'"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "faceset_token = r.json()['faceset_token']\n",
    "faceset_token"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "07a40024",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 2. 查询FaceSet \n",
    "getdetail_url = \"https://api-cn.faceplusplus.com/facepp/v3/faceset/getdetail\"\n",
    "payload = {\n",
    "    'api_key':API_KEY,\n",
    "    'api_secret':API_S,\n",
    "    'faceset_token':faceset_token\n",
    "}\n",
    "r = requests.post(url = getdetail_url, params = payload)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "2210a08a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Response [200]>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "6817fa5f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'faceset_token': 'aa730386c1e33d7c129e0e8a01bf22b4',\n",
       " 'tags': '',\n",
       " 'time_used': 95,\n",
       " 'user_data': '',\n",
       " 'display_name': '',\n",
       " 'face_tokens': [],\n",
       " 'face_count': 0,\n",
       " 'request_id': '1647947377,0171bc50-eff3-4bdf-a10e-b073c90704ae',\n",
       " 'outer_id': ''}"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r.json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "db427b2e",
   "metadata": {},
   "outputs": [],
   "source": [
    "#3. 更新人脸库信息\n",
    "update_FaceSet_url = \"https://api-cn.faceplusplus.com/facepp/v3/faceset/update\"\n",
    "payload = {\n",
    "    'api_key':API_KEY,\n",
    "    'api_secret':API_S,\n",
    "    'faceset_token':faceset_token,\n",
    "    'new_outer_id':'API020305',\n",
    "    'display_name':'2020级网新API周二下午班',\n",
    "    'user_data':'59人',\n",
    "    'tags':''\n",
    "}\n",
    "r = requests.post(url = update_FaceSet_url, params = payload)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "29a2dac2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'time_used': 128,\n",
       " 'facesets': [{'faceset_token': '37071d95016c1b2d81591a6f0c1681f2',\n",
       "   'outer_id': '00001',\n",
       "   'display_name': '网新一班人脸集合',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': 'a1a46eebb6f085052b807ac29364e851',\n",
       "   'outer_id': '000022',\n",
       "   'display_name': '网新人脸集合',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '52ed3456d1211f0ec0387f413ef998aa',\n",
       "   'outer_id': '20201018',\n",
       "   'display_name': '人脸集合1018',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '17765dff78c0e1773da2e60e66715bd1',\n",
       "   'outer_id': 'class1',\n",
       "   'display_name': '网新一人脸集合',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': 'cc34ef13f35cbae14c39f740cd703549',\n",
       "   'outer_id': '01',\n",
       "   'display_name': '网新二班人脸集合',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '0e26875ee281c09c0bd86bfd31293b0f',\n",
       "   'outer_id': 'face_01',\n",
       "   'display_name': '人脸集合face_01',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '756f7940e3a4fa8a8b9cbab4597db902',\n",
       "   'outer_id': 'xianxianbei',\n",
       "   'display_name': '先先贝大家庭',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': 'f0eb3e3e9a51b24ea31b9a9e881c303f',\n",
       "   'outer_id': '20201022',\n",
       "   'display_name': '人脸集合01',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': 'cad9d42816d2e1e0a4dface9c908a51a',\n",
       "   'outer_id': '',\n",
       "   'display_name': '',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '748726d83bee227db8adc00d6cdb60be',\n",
       "   'outer_id': 'Sum',\n",
       "   'display_name': '人脸集合',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': 'adf037ad695c71a53a3ad08c9a80abd6',\n",
       "   'outer_id': 'zixuan',\n",
       "   'display_name': '人脸集合',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '5fa166a6f6ee0c067c5a5babd48a75e1',\n",
       "   'outer_id': 'liling',\n",
       "   'display_name': '人脸集合',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': 'e3d1ac6fecd93d1620d1f3d28f2e5f0e',\n",
       "   'outer_id': '01234',\n",
       "   'display_name': '明星合照',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '8cc0fe245d852e3a95651684f7cabd38',\n",
       "   'outer_id': '0123',\n",
       "   'display_name': '明星合照',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': 'b222523e64a8a02fda52d22e0d3f4fd4',\n",
       "   'outer_id': '',\n",
       "   'display_name': '',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '353805217b2d4ddb58f95a2ca846f215',\n",
       "   'outer_id': '',\n",
       "   'display_name': '',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '00210027c1597f6e84cfd8eac2accce2',\n",
       "   'outer_id': '',\n",
       "   'display_name': '',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '44449bd165373ed5ef0fff9876b409cc',\n",
       "   'outer_id': '',\n",
       "   'display_name': '',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '0908405505240884586edb87974371ed',\n",
       "   'outer_id': '',\n",
       "   'display_name': '',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': 'd137f4015adc54f97287961c78b3c436',\n",
       "   'outer_id': '',\n",
       "   'display_name': '',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': 'd3f897c6fc79a0ab5b6fc0f6185b9b16',\n",
       "   'outer_id': '',\n",
       "   'display_name': '',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '2831295132c881662ea634c6dd50a9a7',\n",
       "   'outer_id': '',\n",
       "   'display_name': '',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '9f38c8acf29bb6eb5aba2696c2f79300',\n",
       "   'outer_id': 'API020305',\n",
       "   'display_name': '2020级网新API周二上午班',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': 'ccb97c28449dabe0c79b0cd6e605ff8c',\n",
       "   'outer_id': '',\n",
       "   'display_name': '',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '00ca4a7af68f7d78fc6a2a3ffc7026c5',\n",
       "   'outer_id': '',\n",
       "   'display_name': '',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': 'a7eef0374c98590ab42192863525bfc4',\n",
       "   'outer_id': '',\n",
       "   'display_name': '',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '8ad54c5293925dae459614f0781e7fbc',\n",
       "   'outer_id': '',\n",
       "   'display_name': '',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '62103072e2a899869387c548600f6d19',\n",
       "   'outer_id': '',\n",
       "   'display_name': '',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': 'aa730386c1e33d7c129e0e8a01bf22b4',\n",
       "   'outer_id': '',\n",
       "   'display_name': '',\n",
       "   'tags': ''}],\n",
       " 'request_id': '1647948906,2a483168-67c1-462c-9665-f8a05ad2c4b0'}"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "0f450aac",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'time_used': 128,\n",
       " 'facesets': [{'faceset_token': '37071d95016c1b2d81591a6f0c1681f2',\n",
       "   'outer_id': '00001',\n",
       "   'display_name': '网新一班人脸集合',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': 'a1a46eebb6f085052b807ac29364e851',\n",
       "   'outer_id': '000022',\n",
       "   'display_name': '网新人脸集合',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '52ed3456d1211f0ec0387f413ef998aa',\n",
       "   'outer_id': '20201018',\n",
       "   'display_name': '人脸集合1018',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '17765dff78c0e1773da2e60e66715bd1',\n",
       "   'outer_id': 'class1',\n",
       "   'display_name': '网新一人脸集合',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': 'cc34ef13f35cbae14c39f740cd703549',\n",
       "   'outer_id': '01',\n",
       "   'display_name': '网新二班人脸集合',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '0e26875ee281c09c0bd86bfd31293b0f',\n",
       "   'outer_id': 'face_01',\n",
       "   'display_name': '人脸集合face_01',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '756f7940e3a4fa8a8b9cbab4597db902',\n",
       "   'outer_id': 'xianxianbei',\n",
       "   'display_name': '先先贝大家庭',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': 'f0eb3e3e9a51b24ea31b9a9e881c303f',\n",
       "   'outer_id': '20201022',\n",
       "   'display_name': '人脸集合01',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': 'cad9d42816d2e1e0a4dface9c908a51a',\n",
       "   'outer_id': '',\n",
       "   'display_name': '',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '748726d83bee227db8adc00d6cdb60be',\n",
       "   'outer_id': 'Sum',\n",
       "   'display_name': '人脸集合',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': 'adf037ad695c71a53a3ad08c9a80abd6',\n",
       "   'outer_id': 'zixuan',\n",
       "   'display_name': '人脸集合',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '5fa166a6f6ee0c067c5a5babd48a75e1',\n",
       "   'outer_id': 'liling',\n",
       "   'display_name': '人脸集合',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': 'e3d1ac6fecd93d1620d1f3d28f2e5f0e',\n",
       "   'outer_id': '01234',\n",
       "   'display_name': '明星合照',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '8cc0fe245d852e3a95651684f7cabd38',\n",
       "   'outer_id': '0123',\n",
       "   'display_name': '明星合照',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': 'b222523e64a8a02fda52d22e0d3f4fd4',\n",
       "   'outer_id': '',\n",
       "   'display_name': '',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '353805217b2d4ddb58f95a2ca846f215',\n",
       "   'outer_id': '',\n",
       "   'display_name': '',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '00210027c1597f6e84cfd8eac2accce2',\n",
       "   'outer_id': '',\n",
       "   'display_name': '',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '44449bd165373ed5ef0fff9876b409cc',\n",
       "   'outer_id': '',\n",
       "   'display_name': '',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '0908405505240884586edb87974371ed',\n",
       "   'outer_id': '',\n",
       "   'display_name': '',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': 'd137f4015adc54f97287961c78b3c436',\n",
       "   'outer_id': '',\n",
       "   'display_name': '',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': 'd3f897c6fc79a0ab5b6fc0f6185b9b16',\n",
       "   'outer_id': '',\n",
       "   'display_name': '',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '2831295132c881662ea634c6dd50a9a7',\n",
       "   'outer_id': '',\n",
       "   'display_name': '',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '9f38c8acf29bb6eb5aba2696c2f79300',\n",
       "   'outer_id': 'API020305',\n",
       "   'display_name': '2020级网新API周二上午班',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': 'ccb97c28449dabe0c79b0cd6e605ff8c',\n",
       "   'outer_id': '',\n",
       "   'display_name': '',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '00ca4a7af68f7d78fc6a2a3ffc7026c5',\n",
       "   'outer_id': '',\n",
       "   'display_name': '',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': 'a7eef0374c98590ab42192863525bfc4',\n",
       "   'outer_id': '',\n",
       "   'display_name': '',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '8ad54c5293925dae459614f0781e7fbc',\n",
       "   'outer_id': '',\n",
       "   'display_name': '',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '62103072e2a899869387c548600f6d19',\n",
       "   'outer_id': '',\n",
       "   'display_name': '',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': 'aa730386c1e33d7c129e0e8a01bf22b4',\n",
       "   'outer_id': '',\n",
       "   'display_name': '',\n",
       "   'tags': ''}],\n",
       " 'request_id': '1647948906,2a483168-67c1-462c-9665-f8a05ad2c4b0'}"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r.json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "73b50e78",
   "metadata": {},
   "outputs": [],
   "source": [
    "getfacesets_url = \"https://api-cn.faceplusplus.com/facepp/v3/faceset/getfacesets\"\n",
    "payload = {\n",
    "    'api_key':API_KEY,\n",
    "    'api_secret':API_S,\n",
    "}\n",
    "r = requests.post(url = getfacesets_url, params = payload)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "072fd348",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'time_used': 132,\n",
       " 'facesets': [{'faceset_token': '37071d95016c1b2d81591a6f0c1681f2',\n",
       "   'outer_id': '00001',\n",
       "   'display_name': '网新一班人脸集合',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': 'a1a46eebb6f085052b807ac29364e851',\n",
       "   'outer_id': '000022',\n",
       "   'display_name': '网新人脸集合',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '52ed3456d1211f0ec0387f413ef998aa',\n",
       "   'outer_id': '20201018',\n",
       "   'display_name': '人脸集合1018',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '17765dff78c0e1773da2e60e66715bd1',\n",
       "   'outer_id': 'class1',\n",
       "   'display_name': '网新一人脸集合',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': 'cc34ef13f35cbae14c39f740cd703549',\n",
       "   'outer_id': '01',\n",
       "   'display_name': '网新二班人脸集合',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '0e26875ee281c09c0bd86bfd31293b0f',\n",
       "   'outer_id': 'face_01',\n",
       "   'display_name': '人脸集合face_01',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '756f7940e3a4fa8a8b9cbab4597db902',\n",
       "   'outer_id': 'xianxianbei',\n",
       "   'display_name': '先先贝大家庭',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': 'f0eb3e3e9a51b24ea31b9a9e881c303f',\n",
       "   'outer_id': '20201022',\n",
       "   'display_name': '人脸集合01',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': 'cad9d42816d2e1e0a4dface9c908a51a',\n",
       "   'outer_id': '',\n",
       "   'display_name': '',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '748726d83bee227db8adc00d6cdb60be',\n",
       "   'outer_id': 'Sum',\n",
       "   'display_name': '人脸集合',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': 'adf037ad695c71a53a3ad08c9a80abd6',\n",
       "   'outer_id': 'zixuan',\n",
       "   'display_name': '人脸集合',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '5fa166a6f6ee0c067c5a5babd48a75e1',\n",
       "   'outer_id': 'liling',\n",
       "   'display_name': '人脸集合',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': 'e3d1ac6fecd93d1620d1f3d28f2e5f0e',\n",
       "   'outer_id': '01234',\n",
       "   'display_name': '明星合照',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '8cc0fe245d852e3a95651684f7cabd38',\n",
       "   'outer_id': '0123',\n",
       "   'display_name': '明星合照',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': 'b222523e64a8a02fda52d22e0d3f4fd4',\n",
       "   'outer_id': '',\n",
       "   'display_name': '',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '353805217b2d4ddb58f95a2ca846f215',\n",
       "   'outer_id': '',\n",
       "   'display_name': '',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '00210027c1597f6e84cfd8eac2accce2',\n",
       "   'outer_id': '',\n",
       "   'display_name': '',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '44449bd165373ed5ef0fff9876b409cc',\n",
       "   'outer_id': '',\n",
       "   'display_name': '',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '0908405505240884586edb87974371ed',\n",
       "   'outer_id': '',\n",
       "   'display_name': '',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': 'd137f4015adc54f97287961c78b3c436',\n",
       "   'outer_id': '',\n",
       "   'display_name': '',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': 'd3f897c6fc79a0ab5b6fc0f6185b9b16',\n",
       "   'outer_id': '',\n",
       "   'display_name': '',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '2831295132c881662ea634c6dd50a9a7',\n",
       "   'outer_id': '',\n",
       "   'display_name': '',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '9f38c8acf29bb6eb5aba2696c2f79300',\n",
       "   'outer_id': 'API020305',\n",
       "   'display_name': '2020级网新API周二上午班',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': 'ccb97c28449dabe0c79b0cd6e605ff8c',\n",
       "   'outer_id': '',\n",
       "   'display_name': '',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '00ca4a7af68f7d78fc6a2a3ffc7026c5',\n",
       "   'outer_id': '',\n",
       "   'display_name': '',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': 'a7eef0374c98590ab42192863525bfc4',\n",
       "   'outer_id': '',\n",
       "   'display_name': '',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '8ad54c5293925dae459614f0781e7fbc',\n",
       "   'outer_id': '',\n",
       "   'display_name': '',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '62103072e2a899869387c548600f6d19',\n",
       "   'outer_id': '',\n",
       "   'display_name': '',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': 'aa730386c1e33d7c129e0e8a01bf22b4',\n",
       "   'outer_id': '',\n",
       "   'display_name': '',\n",
       "   'tags': ''},\n",
       "  {'faceset_token': '95ed03d4290e9c12a9059f934578368d',\n",
       "   'outer_id': 'API021214',\n",
       "   'display_name': '20级网新API周二晚班',\n",
       "   'tags': ''}],\n",
       " 'request_id': '1647951994,f0405bdd-2fa6-4c74-a741-1cc159bc98e8'}"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r.json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "bb3ebdf9",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  },
  "varInspector": {
   "cols": {
    "lenName": 16,
    "lenType": 16,
    "lenVar": 40
   },
   "kernels_config": {
    "python": {
     "delete_cmd_postfix": "",
     "delete_cmd_prefix": "del ",
     "library": "var_list.py",
     "varRefreshCmd": "print(var_dic_list())"
    },
    "r": {
     "delete_cmd_postfix": ") ",
     "delete_cmd_prefix": "rm(",
     "library": "var_list.r",
     "varRefreshCmd": "cat(var_dic_list()) "
    }
   },
   "types_to_exclude": [
    "module",
    "function",
    "builtin_function_or_method",
    "instance",
    "_Feature"
   ],
   "window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
